﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class FamilyRelationshipBL
	{

		#region ***** Init Methods ***** 
		FamilyRelationshipDA objFamilyRelationshipDA;
		public FamilyRelationshipBL()
		{
			objFamilyRelationshipDA = new FamilyRelationshipDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get FamilyRelationship by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>FamilyRelationship</returns>
        public FamilyRelationship GetByID(int id, int PersonalProfileID)
		{
            return objFamilyRelationshipDA.GetByID(id, PersonalProfileID);
		}

		/// <summary>
		/// Get all of FamilyRelationship
		/// </summary>
		/// <returns>List<<FamilyRelationship>></returns>
		public List<FamilyRelationship> GetList()
		{
			string cacheName = "lstFamilyRelationship";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objFamilyRelationshipDA.GetList(), "FamilyRelationship");
			}
			return (List<FamilyRelationship>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of FamilyRelationship
		/// </summary>
		/// <returns>DataSet</returns>
        public DataSet GetDataSet(int PersonalProfileID)
		{
			string cacheName = "dsFamilyRelationship";
            ServerCache.Remove("dsFamilyRelationship");
			if( ServerCache.Get(cacheName) == null )
			{
                ServerCache.Insert(cacheName, objFamilyRelationshipDA.GetDataSet(PersonalProfileID), "FamilyRelationship");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of FamilyRelationship paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<FamilyRelationship>></returns>
		public List<FamilyRelationship> GetListPaged(int recperpage, int pageindex)
		{
			return objFamilyRelationshipDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of FamilyRelationship paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objFamilyRelationshipDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new FamilyRelationship within FamilyRelationship database table
		/// </summary>
		/// <param name="obj_familyrelationship">FamilyRelationship</param>
		/// <returns>key of table</returns>
		public int Add(FamilyRelationship obj_familyrelationship)
		{
			ServerCache.Remove("FamilyRelationship", true);
			return objFamilyRelationshipDA.Add(obj_familyrelationship);
		}

		/// <summary>
		/// updates the specified FamilyRelationship
		/// </summary>
		/// <param name="obj_familyrelationship">FamilyRelationship</param>
		/// <returns></returns>
		public void Update(FamilyRelationship obj_familyrelationship)
		{
			ServerCache.Remove("FamilyRelationship", true);
			objFamilyRelationshipDA.Update(obj_familyrelationship);
		}

		/// <summary>
		/// Delete the specified FamilyRelationship
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("FamilyRelationship", true);
			objFamilyRelationshipDA.Delete(id);
		}
		#endregion
	}
}
